<header id="topbar" class="affix" style="top:60px;">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="#op/add_coin/">上分管理</a>
            </li>
        </ol>
    </div>
    <div class="topbar-right">
        <div class="btn btn-default btn-sm light fw600 ml10" id="addNewItem"><span class="fa fa-plus pr5"></span>新增上分
        </div>
        <div class="ml15 ib va-m" id="toggle_sidemenu_r">
            <a href="#" class="pl5"> <i class="fa fa-sign-in fs22 text-primary"></i>
            </a>
        </div>
    </div>
</header>

<section id="content" class="animated fadeIn">
    <% if(items.length > 0){ %>
    <div class="panel overflow">
        <table class="table table-striped fs13" id="main-list">
            <thead>
            <tr class="bg-light">
                <th>上分单号</th>
                <th>用户昵称</th>
                <th>用户ID</th>
                <th>上分金额</th>
                <th>可否提现</th>
                <th class="sortable" data-field="created_at">上分时间</th>
                <th>操作人</th>
                <th>备注</th>
            </tr>
            </thead>
            <tbody class="admin-form">
            <%
            var sum = 0;
            _.each(items, function(item){
            sum += parseInt(item.amount);
            %>
            <tr data-uid="<%= item.id %>" data-id="<%= item.id %>">
                <td><%= item.id %></td>
                <td><%= item.user_name %></td>
                <td><a href="#stats/account/?id=<%= item.user_id %>"><%= item.user_id %></a></td>
                <td><%= item.amount %></td>
                <td><%= item.enable_withdraw? '可提现': '不可提现'%></td>
                <td><%= item.created_at %></td>
                <td><%= item.operator %></td>
                <td><%= item.note %></td>
            </tr>
            <%
            }) %>
            </tbody>
        </table>
    </div>
    <div>
        <div class="pull-left" id="page-tips"></div>
        <span style="margin-left:20px;">总共：</span><span style="color:#F00"><%= sum %></span>
        <div id="paginator"></div>
    </div>
    <% }else{ %>
    <h4 class="text-muted">无数据</h4>
    <% } %>
</section>

<!-- Panel popup -->
<div id="addNewItemPanel" class="popup-basic popup-lg bg-none mfp-with-anim mfp-hide">
    <div class="panel">
        <div class="panel-heading">
            <span class="panel-icon"><i class="fa fa-pencil"></i></span>
            <span class="panel-title">新增上分</span>
        </div>
        <div class="panel-body">
            <form id="behavior-form" class="form-horizontal  ml15" role="form">
                <div class="form-group">
                    <label class=" control-label mb5">请输入上分信息：</label>
                    <div>
                        <textarea title="用户ID" id="awardInfo" class="gui-textarea h-200 col-lg-10"
                                  data-field="amount_info"
                                  placeholder="例如：&#10张三，65676，800&#10，67900，500&#10李四，，700"></textarea>
                    </div>
                    <div style="clear: both;"><span>昵称，ID，上分金额用逗号隔开；多条信息用换行符隔开</span></div>
                </div>
                <div class="form-group">
                    <label class="control-label mb5 mt5">可否提现：</label>
                    <div>
                        <select id="enable_withdraw" data-field="withdraw" class="form-control">
                            <option value=0>不可提现</option>
                            <option value=1>可提现</option>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label mb5 mt5">是否加入提现黑名单：</label>
                    <div>
                        <select id="inputStatus" data-field="status" class="form-control multiselect">
                            <option value="no_enter">不加入提现黑名单</option>
                            <option value="test_uid">测试id</option>
                            <option value="black_uid">恶意用户id</option>
                            <option value="black_sales">电销黑名单</option>
                            <option value="black_operations">运营活动黑名单</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label mb5 mt5">备注：</label>
                    <div>
                        <textarea id="note" class="gui-textarea h-50 col-lg-10" data-field="note"
                                  placeholder="请输入备注信息（选填）"></textarea>
                    </div>
                </div>
            </form>
        </div>
        <div class="panel-footer text-right">
            <button class="btn btn-default" type="button" id="cancelAddNewItem">取消</button>
            <button class="btn btn-primary" type="button" id="confirmAddNewItem">确定</button>
        </div>
    </div>
</div>

<!-- Start: Right Sidebar -->
<aside id="sidebar_right" class="nano" style="top: 110px;">
    <div class="p20 admin-form">
        <h4 class="mt5 text-muted fw500">过滤条件：</h4>
        <hr class="short">
        <div class="section mb15">
            <label class="field prepend-icon">
                <input title="ID" type="text" id="searchId" class="gui-input" data-field="id" placeholder="订单ID"
                       value="<%= searched.id %>">
                <input title="用户ID" type="text" id="searchUid" class="gui-input" data-field="user_id" placeholder="用户ID"
                       value="<%= searched.user_id %>">
                <label class="field-icon"><i class="fa fa-tag"></i>
                </label>
            </label>
        </div>

        <h6 class="fw400">申请时间</h6>
        <div class="section row" id="searchCreatedAt">
            <div class="col-md-6">
                <input type="text" class="gui-input datetime-input" data-field="created_at.$gte" data-useless=""
                       placeholder=">=" value="<%= searched.created_at ? searched.created_at.$gte : '' %>">
            </div>
            <div class="col-md-6">
                <input type="text" class="gui-input datetime-input" data-field="created_at.$lte" data-useless=""
                       placeholder="<=" value="<%= searched.created_at ? searched.created_at.$lte : '' %>">
            </div>
        </div>
        <h6 class="fw400">可否提现</h6>
        <div class="section mb15">
            <label class="field select">
                <select id="EnableWithdraw" name="enable_withdraw" data-field="enable_withdraw">
                    <option value=1
                    <%= searched.enable_withdraw == 1 ? 'selected' : '' %>>可提现</option>
                    <option value=0
                    <%= searched.enable_withdraw == 0 ? 'selected' : '' %>>不可提现</option>
                </select>
                <i class="arrow double"></i>
            </label>
        </div>


        <h6 class="fw400">操作人员</h6>
        <div class="section mb15">
            <label class="field select">
                <select id="searchOp" name="searchOp" data-field="operator">
                    <option value="0"
                    <%= searched.operator == 0 ? 'selected' : '' %>>所有操作员</option>
                    <option value="41"
                    <%= searched.operator == 41 ? 'selected' : '' %>>stephen</option>
                    <option value="51"
                    <%= searched.operator == 51 ? 'selected' : '' %>>victor</option>
                </select>
                <i class="arrow double"></i>
            </label>
        </div>
        <hr class="short">

        <div class="row">
            <div class="col-md-6">
                <button class="btn btn-primary btn-block form-control" id="search">搜索</button>
            </div>
            <div class="col-md-6">
                <button class="btn btn-default btn-block form-control" id="export">导出</button>
            </div>
        </div>

    </div>
</aside>
<!-- End: Right Sidebar -->